﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SanPhamDetails.ascx.cs"
    Inherits="UserControl_SanPhamDetails" %>
<%@ Register src="../ZoomControl/ZoomControl.ascx" tagname="ZoomControl" tagprefix="uc1" %>

<style type="text/css">
    
    #image
    {
        height: 283px;
        width: 216px;
    }
</style>

<script src="ZoomControl/jqzoom.pack.1.0.1.js" type="text/javascript"></script>
<link rel="stylesheet" href="ZoomControl/jqzoom.css" type="text/css">
<script type="text/javascript">

    $(function () {
        var options2 =
            {
                zoomWidth: 550,
                zoomHeight: 400,
                position: 'right',
                showEffect: 'show',
                hideEffect: 'fadeout',
                fadeoutSpeed: 'slow',
                lens: false,
                title: false
            }

        $(".jqzoom").jqzoom(options2);
    });
</script>

<script type="text/javascript">
    function nam(image) {
        document.getElementById('image').src = image;
        document.getElementById('link').href = image;
    }
   
</script>
<link href="Css/jquery.lightbox-0.5.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery.lightbox-0.5.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $('#galleryBox a').lightBox();
    });

</script>
<div id="other">
   &nbsp;<asp:Label ID="lblTitle" runat="server" CssClass="title-item" Text='Thông tin sản phẩm'></asp:Label>
</div>
<div id="galleryBox" style="margin-left: 0px; padding-left: 0px;float:left;">
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="MaSanPham"
        DataSourceID="SqlDataSourceSanPhamDetails" EnableModelValidation="True" Height="50px"
        Width="100%" BorderWidth="0px" GridLines="None">
        <fields>
            <asp:TemplateField>
                <ItemTemplate>
                
                    <table width="100%" cellpadding="0" cellspacing="0">
                        
                        <tr>
                            <td align="center" width="130px">
                            <br />
                                <uc1:ZoomControl ID="ZoomControl2" runat="server" />
                        <asp:DetailsView ID="DetailsView2" runat="server" AutoGenerateRows="False" DataKeyNames="ID"
                                    DataSourceID="SqlDataSourceHinhAnh" EnableModelValidation="True" 
                                    BorderWidth="0px" GridLines="None">
                                    <Fields>
                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                <div align="center" style="text-align: center">
                                                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("URL") %>'>
                                                        Xem ảnh lớn
                                                    </asp:HyperLink>
                                                    <br />
                                                    <br />
                                                    <%--<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# Eval("URL") %>'>Xem thêm ảnh</asp:HyperLink>--%>
                                                </div>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Fields>
                                </asp:DetailsView>

                                <asp:SqlDataSource ID="SqlDataSourceHinhAnh" runat="server" ConnectionString="<%$ ConnectionStrings:KinhMatConnecString %>"
                                    SelectCommand="SELECT * FROM [HinhAnh] WHERE ([MaSanPham] = @MaSanPham)">
                                    <SelectParameters>
                                        <asp:QueryStringParameter Name="MaSanPham" QueryStringField="id_product" Type="String" />
                                    </SelectParameters>
                                </asp:SqlDataSource>
                            </td>
                            <td align="left" style="vertical-align: top; padding-right: 25px;" valign="top" 
                                width="10px">
                                &nbsp;
                                </td>
                            <td style="vertical-align: top; text-align: left">
                                <br />
                                MÃ SP:
                                <asp:Label ID="lblMaSP" runat="server" Font-Bold="True" Font-Size="Large" ForeColor="#666666"
                                    Text='<%# Eval("MaSanPham") %>'></asp:Label>
                                <br />
                                Sản phẩm:
                                <asp:Label ID="lblNhanhieu" runat="server" ForeColor="Gray" Text='<%# Eval("tenTH") %>'></asp:Label>
                                <br />
                                Loại :
                                <asp:Label ID="lblLoai" runat="server" ForeColor="Gray" Text='<%# Eval("TenLoai") %>'></asp:Label>
                                <br />
                                <asp:Label ID="lblGia" runat="server" Font-Bold="False" Font-Italic="False" ForeColor="#FF6600"
                                    Text='<%# Eval("GiaBan", "Giá: {0:N0}VNĐ") %>'></asp:Label>
                                <br />
                                <asp:Label ID="Label2" runat="server" Font-Strikeout="True" Text='<%# Eval("GiaCu", "Giá cũ: {0:N0}VNĐ") %>'></asp:Label>
                                <br />
                                ----------------------------------------------------------------------------------------------<br /> <strong>THÔNG TIN TÀI KHOẢN
                                <br />
                                &nbsp;- Ngân hàng Công thương Việt nam
                                <br />
                                &nbsp;- Số TK : 100001-012020-1123 </strong>
                                <br />
                                <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Image/addcart.png"
                                    CommandArgument='<%# Eval("MaSanPham") %>' CommandName="btnMuaHang" OnClick="ImageButton1_Click"
                                    Visible="False" />
                                <br />
                                <hr />
                                <br />
                                <asp:Label ID="lblMota" runat="server" Text='<%# Eval("GioiThieu") %>'></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" valign="top" colspan="3">
                                <br />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3" valign="top">
                                <asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Eval("LoaiID") %>' />
                                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                                    SelectCommand="SELECT TOP (9) SanPham.MaSanPham, (SELECT TOP (1) URL FROM HinhAnh WHERE (MaSanPham = SanPham.MaSanPham)) AS hinhanh, SanPham.GiaBan, SanPham.LoaiID, SanPham.Xoa, SanPham.ChucNangID, SanPham.NhanHieuID, Loai.TenLoai FROM SanPham INNER JOIN Loai ON SanPham.LoaiID = Loai.ID INNER JOIN HinhAnh AS HinhAnh_1 ON SanPham.MaSanPham = HinhAnh_1.MaSanPham WHERE (Loai.ID = @id) AND (SanPham.MaSanPham &lt;&gt; @idsp) GROUP BY SanPham.MaSanPham, SanPham.GiaBan, SanPham.LoaiID, SanPham.Xoa, SanPham.ChucNangID, SanPham.NhanHieuID, Loai.TenLoai">
                                    <SelectParameters>
                                        <asp:ControlParameter ControlID="HiddenField1" Name="id" PropertyName="Value" />
                                        <asp:QueryStringParameter Name="idsp" QueryStringField="id_product" />
                                    </SelectParameters>
                                </asp:SqlDataSource>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:TemplateField>
        </fields>
    </asp:DetailsView>
    <asp:SqlDataSource ID="SqlDataSourceSanPhamDetails" runat="server" ConnectionString="<%$ ConnectionStrings:KinhMatConnecString %>"
        SelectCommand="SELECT SanPham.MaSanPham, SanPham.GiaBan, SanPham.GiaCu,SanPham.NgayCapNhat, SanPham.LoaiID, SanPham.Xoa AS Expr1, SanPham.GioiThieu, SanPham.ChucNangID, SanPham.NhanHieuID, Loai.TenLoai, NhanHieu.Ten AS tenTH, ChucNang.Ten AS tenCN FROM SanPham INNER JOIN Loai ON SanPham.LoaiID = Loai.ID INNER JOIN NhanHieu ON SanPham.NhanHieuID = NhanHieu.ID LEFT OUTER JOIN ChucNang ON SanPham.ChucNangID = ChucNang.ID WHERE (SanPham.MaSanPham = @MaSanPham)">
        <selectparameters>
            <asp:QueryStringParameter Name="MaSanPham" QueryStringField="id_product" Type="String" />
        </selectparameters>
    </asp:SqlDataSource>
    <asp:Label ID="Label1" runat="server" ></asp:Label>
</div>
